<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ include file="../Main/top.jsp"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<script type="text/javascript" src="Users.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		initForm("insert",0,"0"); //根据用户等级判断下级显示项,0代表空值
		checkUserNameIsNotUsed();  //检查用户名是否被占用
		dealSubmit(); //点击提交按钮时处理角色和班级
		createLevelChange();
		createDepartmentChange(); //系所与班级的AJAX数据处理
		queryRolesList(0);
	});
</script>
	
<div class="function_title"><span class="t2"><img src="../images/dqwz.gif">当前位置：添加用户</span></div>
<div class="function_content">

<div class="addItem"><img src="../images/return_icon.png"><a href="listUsers.action?intercept=1">返回列表</a></div>

<span class="important_info">注：带*项为必填信息!</span>
<form action="insertUsers.action" method="post" id="demo" >
<input type="hidden" name="users.author" id="users.author" value="<s:property value="#session.userName" />">
<input type="hidden" name="users.roleCollection" id ="users.roleCollection">
<input type="hidden" name="users.classCollection" id ="users.classCollection">
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="loginTable">
    <tr>
      <td width="14%" align="right" class="leftBg"><span class="important_info">*</span>用户名：</td>
      <td width="86%"><input type="text" name="users.userName" id="userName"><span id="ajaxShowResult" class="ajaxShowResult"></span>
</td>
    </tr>
<tr>
      <td width="14%" align="right" class="leftBg"><span class="important_info">*</span>密码：</td>
      <td width="86%"><input type="password" name="users.password" id="password" value="111111">
</td>
    </tr>
<tr>
      <td width="14%" align="right" class="leftBg"><span class="important_info">*</span>确认密码：</td>
      <td width="86%"><input type="password" name="repeatPassword" id="repeatPassword" value="111111">
</td>
    </tr>
    <tr>
      <td align="right" class="leftBg"><span class="important_info">*</span>真实姓名：</td>
      <td><input type="text" name="users.realName" id="users.realName">
</td>
    </tr>
<tr>
      <td align="right" class="leftBg">联系方式：</td>
      <td><input type="text" name="users.telNum" id="users.telNum">
</td>
    </tr>
    <tr>
      <td align="right" class="leftBg"><span class="important_info">*</span>可选角色列表：</td>
		<td>
		<select name="rolesId" id="rolesId"><option value=''>--未选择--</option></select>
		</td>    
	</tr>
<tr>
      <td align="right" class="leftBg"><span class="important_info">*</span>管理范围：</td>
      <td>
<select name="users.level" id="level">
	<option value="">--未选择--</option>
	<option value="1">院级</option>
	<option value="2">系级</option>
	<option value="3">班级</option>
</select>
</td>
    </tr>

	<tr id="departmentIdLine">
      <td align="right" class="leftBg"><span class="important_info">*</span>所管系所：</td>
      <td><select name="users.departmentId" id="departmentId"></select></td>
    </tr>
<tr id="classIdLine">
      <td align="right" class="leftBg"><span class="important_info">*</span>所管班级：</td>
      <td><select name="users.classId" id="classId" multiple="multiple" class="multiple_select"></select></td>
    </tr>
    <tr>
      <td align="right">&nbsp;</td>
      <td>
        <input type="submit" name="submit" id="submit" value="提交" class="deal_button">
        <input type="reset" name="reset" id="reset" value="重置" class="deal_button">
      </td>
    </tr>
  </table>
</form>

</div>

<%@ include file="../Main/bottom.jsp"%>